home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 February: Tool Chest / Dev.CD Feb 99 TC.toast / Tool Chest / Toolbox / Balloony / Balloony.r < prev    next >
Encoding:
Text File  |  1997-10-16  |  14.1 KB  |  533 lines  |  [TEXT/KAHL]

  1. /* Balloony.r - the definitions of resources that are easily describable textually.
  2.     November 11, 1996: I, David Phillip Oster, place this source code in the public
  3.         domain. This means you can do anyhing you want with it.
  4.     It would be considerate if you kept me posted on any bugs, bug fixes, or
  5.     improvements.
  6.     oster@netcom.com
  7.  */
  8. #include "Types.r"
  9. #include "SysTypes.r"
  10. #include "BalloonTypes.r"
  11. #include "BalloonyRes.h"
  12. #define hMenuBase    2000
  13. #define hDlogBase    3000
  14.  
  15. include "Balloony.RESOURCES";
  16.  
  17.  
  18. resource 'DLOG' (rAbout, purgeable) {
  19.     {80, 66, 215, 383},
  20.     dBoxProc,
  21.     invisible,
  22.     noGoAway,
  23.     0x0,
  24.     rAbout,
  25.     "About"
  26. };
  27.  
  28.  
  29. resource 'DITL' (rAbout, purgeable) {{
  30.     /* [1] */    {145, 240, 165, 298},    Button {    enabled,    "OK"    },
  31.     /* [2] */    {145, 162, 165, 220},    Button {    enabled,    "Cancel"    },
  32.     /* [3] */    {9, 12, 74, 303},        StaticText {enabled,    "Balloony: Version 1.00. A program to create stub balloon help .r files from an application. Just drop your application onto it."    },
  33.     /* [4] */    {74, 12, 130, 303},        StaticText {enabled,    "Copyright © by David Phillip Oster, 1994, All Rights Reserved. Write to me at oster@netcom.com for more information."    },
  34.     /* [5] */    {0, 0, 0, 0},            helpItem { disabled, HMScanhdlg {rAbout} }
  35. }};
  36.  
  37. #define AboutHdlg hDlogBase+rAbout
  38. resource 'STR#' (AboutHdlg, purgeable) {{
  39.     /* 1 */    "Click here to make this dialog box go away."
  40. }};
  41.  
  42. /* The 'dlg' resource connects ditl items to STR# items.
  43.  */
  44. resource 'hdlg' (rAbout, purgeable) {
  45.     HelpMgrVersion,
  46.     0,    /* start with first item */
  47.     hmDefaultOptions,
  48.     0,    /* balloon def id */
  49.     0,    /* var code, hang right */
  50.     HMSkipItem {},    /* default item */
  51.     {
  52.     HMSkipItem {},
  53.     HMSkipItem {},
  54.     HMStringResItem {{0,0}, {0,0,0,0}, AboutHdlg, 1, AboutHdlg, 1, AboutHdlg, 1, AboutHdlg, 1 },
  55.     HMStringResItem {{0,0}, {0,0,0,0}, AboutHdlg, 1, AboutHdlg, 1, AboutHdlg, 1, AboutHdlg, 1 }
  56. }};
  57.  
  58.  
  59. resource 'dctb' (rAbout, purgeable) {{
  60.     wContentColor, 48059, 48059, 48059,
  61.     wFrameColor, 0, 0, 0,
  62.     wTextColor, 0, 0, 0,
  63.     wHiliteColor, 0, 0, 0,
  64.     wTitleBarColor, 65535, 65535, 65535
  65. }};
  66.  
  67.  
  68. resource 'DLOG' (rProgress, purgeable) {
  69.     {80, 66, 183, 343},
  70.     dBoxProc,
  71.     invisible,
  72.     noGoAway,
  73.     0x0,
  74.     rProgress,
  75.     "Progress"
  76. };
  77.  
  78. #define kBoxL    7
  79. #define kBoxT    61
  80.  
  81. resource 'DITL' (rProgress, purgeable) {{
  82.     /* [1] */    {130, 740, 150, 798},    Button {    enabled,    "OK"    },
  83.     /* [2] */    {62, 165, 82, 223},        Button {    enabled,    "Cancel"    },
  84.     /* [3] */    {32, 12, 57, 241},        StaticText {disabled,    ""    },
  85.     /* [4] */    {9, 12, 26, 241},        StaticText {disabled,    "Now adding stub Balloon Help to:"    },
  86.     /* [5] */    {0, 0, 0, 0},            helpItem { disabled, HMScanhdlg { rProgress } }
  87. }};
  88.  
  89. #define ProgressHdlg hDlogBase+rProgress
  90. resource 'STR#' (ProgressHdlg, purgeable) {{
  91.     /* 1 */    "Balloony is building the stub help resources for this item."
  92. }};
  93.  
  94. /* The 'dlg' resource connects ditl items to STR# items.
  95.  */
  96. resource 'hdlg' (rProgress, purgeable) {
  97.     HelpMgrVersion,
  98.     0,    /* start with first item */
  99.     hmDefaultOptions,
  100.     0,    /* balloon def id */
  101.     0,    /* var code, hang right */
  102.     HMSkipItem {},    /* default item */
  103.     {
  104.     HMSkipItem {},    /* OK */
  105.     HMSkipItem {},    /* Cancel */
  106.     HMStringResItem {{0,0}, {0,0,0,0}, ProgressHdlg, 1, ProgressHdlg, 1, ProgressHdlg, 1, ProgressHdlg, 1 }
  107. }};
  108.  
  109.  
  110. resource 'dctb' (rProgress, purgeable) {{
  111.     wContentColor, 48059, 48059, 48059,
  112.     wFrameColor, 0, 0, 0,
  113.     wTextColor, 0, 0, 0,
  114.     wHiliteColor, 0, 0, 0,
  115.     wTitleBarColor, 65535, 65535, 65535
  116. }};
  117.  
  118.  
  119. resource 'DLOG' (rOptions, purgeable) {
  120.     {80, 66, 243, 383},
  121.     movableDBoxProc,
  122.     invisible,
  123.     noGoAway,
  124.     0x0,
  125.     rOptions,
  126.     "Balloony"
  127. };
  128.  
  129. #define kBoxL    7
  130. #define kBoxT    61
  131.  
  132. resource 'DITL' (rOptions, purgeable) {{
  133.     /* [1] */    {130, 240, 150, 298},    Button {    enabled,    "OK"    },
  134.     /* [2] */    {130, 162, 150, 220},    Button {    enabled,    "Cancel"    },
  135.     /* [3] */    {73, 10, 91, 30},        RadioButton {enabled,    ""    },
  136.     /* [4] */    {95, 10, 112, 30},        RadioButton {enabled,    ""    },
  137.     /* [5] */    {65, 30, 97, 62},        Icon {    disabled,    130    },
  138.     /* [6] */    {90, 30, 122, 62},        Icon {    disabled,    129    },
  139. }};
  140.  
  141. resource 'dctb' (rOptions, purgeable) {{
  142.     wContentColor, 48059, 48059, 48059,
  143.     wFrameColor, 0, 0, 0,
  144.     wTextColor, 0, 0, 0,
  145.     wHiliteColor, 0, 0, 0,
  146.     wTitleBarColor, 65535, 65535, 65535
  147. }};
  148.  
  149. resource 'ALRT' (rError, "Error", purgeable) {
  150.     {56, 64, 184, 438},
  151.     rError,
  152.     {    OK, visible, sound1,
  153.         OK, visible, sound1,
  154.         OK, visible, sound1,
  155.         OK, visible, sound1    
  156. }};
  157.  
  158. resource 'DITL' (rError, "Error", purgeable) {{
  159.     {98, 300, 118, 360},    Button {    enabled,    "OK"    },
  160.     {9, 55, 93, 360},    StaticText {    disabled,    "^0  (^1)"    },
  161.     {9, 12, 41, 44},    Icon {        disabled,        0    }
  162. }};
  163.  
  164. #define kAllItems    0x7FFFFFFF
  165. #define kItem1        (1 << (1 - 1))
  166. #define kItem2        (1 << (2 - 1))
  167.  
  168. resource 'MENU' (kAppleMenu, "kAppleMenu") {
  169.     kAppleMenu,
  170.     textMenuProc,
  171.     0x7FFFFFFD,
  172.     enabled,
  173.     apple,
  174.     {
  175.         "About Balloony…", noIcon, noKey, noMark, plain,
  176.         "-", noIcon, noKey, noMark, plain
  177. }};
  178.  
  179. #define kAppleHmnu hMenuBase+kAppleMenu
  180. resource 'STR#' (kAppleHmnu, purgeable) {{
  181.     /* 1 */    "The Apple menu contains commands for bringing up items in the Apple Menu Item folder in your System Folder.",
  182.     /* 2 */    "This brings up a dialog box with information about this program."
  183. }};
  184.  
  185. /* The 'hmnu' resource connects menu items to STR# items.
  186.  */
  187. resource 'hmnu' (kAppleMenu, purgeable) {
  188.     HelpMgrVersion,
  189.     hmDefaultOptions,
  190.     0,    /* balloon def id */
  191.     0,    /* var code, hang right */
  192.     HMSkipItem {},    /* default item */
  193.     {
  194.     HMStringResItem {kAppleHmnu, 1, kAppleHmnu, 1, kAppleHmnu, 1, kAppleHmnu, 1 },
  195.     HMStringResItem {kAppleHmnu, 2, kAppleHmnu, 2, kAppleHmnu, 2, kAppleHmnu, 2 }
  196. }};
  197.  
  198.  
  199. resource 'MENU' (kFileMenu, "kFileMenu") {
  200.     kFileMenu,
  201.     textMenuProc,
  202.     allEnabled,
  203.     enabled,
  204.     "File",
  205.     {
  206.         "Open", noIcon, "O", noMark, plain,
  207.         "-", noIcon, noKey, noMark, plain,
  208.         "Quit", noIcon, "Q", noMark, plain
  209. }};
  210.  
  211. #define kFileHmnu hMenuBase+kFileMenu
  212. resource 'STR#' (kFileHmnu, purgeable) {{
  213.     /* 1 */    "The File menu contains commands for the general operation of this program.",
  214.     /* 2 */    "Open\n\nOpens an application <App> and makes a file named “<App> Help.r” with template balloon help for the menus and dialogs.",
  215.     /* 3 */    "Quit\n\nQuits this program."
  216. }};
  217.  
  218. /* The 'hmnu' resource connects menu items to STR# items.
  219.  */
  220. resource 'hmnu' (kFileMenu, purgeable) {
  221.     HelpMgrVersion,
  222.     hmDefaultOptions,
  223.     0,    /* balloon def id */
  224.     0,    /* var code, hang right */
  225.     HMSkipItem {},    /* default item */
  226.     {
  227.     HMStringResItem {kFileHmnu, 1, kFileHmnu, 1, kFileHmnu, 1, kFileHmnu, 1 },
  228.     HMStringResItem {kFileHmnu, 2, kFileHmnu, 2, kFileHmnu, 2, kFileHmnu, 2 },
  229.     HMSkipItem {},
  230.     HMStringResItem {kFileHmnu, 3, kFileHmnu, 3, kFileHmnu, 3, kFileHmnu, 3 }
  231. }};
  232.  
  233. resource 'MENU' (kEditMenu, "kEditMenu") {
  234.     kEditMenu,
  235.     textMenuProc,
  236.     kAllItems - (kItem2),
  237.     enabled,
  238.     "Edit",
  239.     {    /* array: 6 elements */
  240.         "Undo", noIcon, "Z", noMark, plain,
  241.         "-", noIcon, noKey, noMark, plain,
  242.         "Cut", noIcon, "X", noMark, plain,
  243.         "Copy", noIcon, "C", noMark, plain,
  244.         "Paste", noIcon, "V", noMark, plain,
  245.         "Clear", noIcon, noKey, noMark, plain
  246.     }
  247. };
  248.  
  249. #define kEditHmnu hMenuBase+kEditMenu
  250. resource 'STR#' (kEditHmnu, purgeable) {{
  251.     /* 1 */    "The Edit menu has commands relating to editing text. It is here only for compatibility.",
  252.     /* 2 */    "Undo\n\nlets you undo your changes. Not implemented in this program.",
  253.     /* 3 */    "Cut\n\nlets you move your selection to the clipboard. Not implemented in this program.",
  254.     /* 4 */    "Copy\n\nlets you duplicate your selection in the clipboard. Not implemented in this program.",
  255.     /* 5 */    "Paste\n\nlets you replace your selection with the contents of the clipboard. Not implemented in this program.",
  256.     /* 6 */    "Clear\n\nlets you delete your selection. Not implemented in this program."
  257. }};
  258.  
  259. /* The 'hmnu' resource connects menu items to STR# items.
  260.  */
  261. resource 'hmnu' (kEditMenu, purgeable) {
  262.     HelpMgrVersion,
  263.     hmDefaultOptions,
  264.     0,    /* balloon def id */
  265.     0,    /* var code, hang right */
  266.     HMSkipItem {},    /* default item */
  267.     {
  268.     HMStringResItem {kEditHmnu, 1, kEditHmnu, 1, kEditHmnu, 1, kEditHmnu, 1 },
  269.     HMStringResItem {kEditHmnu, 2, kEditHmnu, 2, kEditHmnu, 2, kEditHmnu, 2 },
  270.     HMSkipItem {},
  271.     HMStringResItem {kEditHmnu, 3, kEditHmnu, 3, kEditHmnu, 3, kEditHmnu, 3 },
  272.     HMStringResItem {kEditHmnu, 4, kEditHmnu, 4, kEditHmnu, 4, kEditHmnu, 4 },
  273.     HMStringResItem {kEditHmnu, 5, kEditHmnu, 5, kEditHmnu, 5, kEditHmnu, 5 },
  274.     HMStringResItem {kEditHmnu, 6, kEditHmnu, 6, kEditHmnu, 6, kEditHmnu, 6 }
  275. }};
  276.  
  277. resource 'MBAR' (kMBAR, purgeable) {{
  278.         kAppleMenu,
  279.         kFileMenu,
  280.         kEditMenu
  281. }};
  282.  
  283. resource 'STR#' (kMainStrs, purgeable) {{
  284.     "Help.r",
  285.     "Balloony Prefs",
  286.     "KAHL",
  287.     "TEXT",
  288.     "\n\tHMSkipItem {}"
  289. }};
  290. resource 'STR#' (kSmallStrs) {{
  291.     "^1",    /* the menu/ditl resource name  (also the hmnu/hdlg one.) */
  292.     "^2",    /* the STR# resource name */
  293.     "^3",    /* the current STR# string number */
  294.     "-",    /* a dividing line in a menu */
  295.     "1",
  296.     ",\n",
  297.     ",",
  298.     "h",
  299.     "Menu",
  300.     "Hmnu",
  301.     "cntl",
  302.     "button",
  303.     "checkBox",
  304.     "radioButton",
  305.     "text",
  306.     "edit",
  307.     "icon",
  308.     "pict",
  309.     "user",
  310.     "Unknown",
  311.     "Ditl",
  312.     "Hdlg"
  313. }};
  314.  
  315. resource 'STR#' (kErrorStrs, purgeable) {{
  316.     "An error occurred.",
  317.     "Directory full.",    /* kDirFulErr */    
  318.     "Disk full.",        /* kDskFulErr */    
  319.     "No such volume.",    /* kNsvErr */    
  320.     "I/O error.",        /* kIOErr */    
  321.     "Bad Name.",        /* kBdNamErr */    
  322.     "File not open.",    /* kFnOpnErr */    
  323.     "End of file.",        /* kEofErr */    
  324.     "Tried to position to before start of file (r/w).",    /* kPosErr */    
  325.     "Memory full (open) or file won't fit (load).",    /* kMFulErr */    
  326.     "Too many files open.",    /* kTmfoErr */    
  327.     "File not found.",    /* kFnfErr */    
  328.     "Diskette is write protected.",    /* kWPrErr */    
  329.     "File is locked.",    /* kFLckdErr */    
  330.     "Volume is locked.",    /* kVLckdErr */    
  331.     "File is busy (delete).",    /* kFBsyErr */    
  332.     "Duplicate filename. Probably can’t create “…Help.r” output file because it already exists.",    /* kDupFNErr */    
  333.     "File already open with write permission.",    /* kOpWrErr */    
  334.     "Refnum error.",    /* kRfNumErr */    
  335.     "Get file position error.",    /* kGfpErr */    
  336.     "Volume not on line error (was Ejected).",    /* kVolOffLinErr */    
  337.     "Permissions error (on file open).",    /* kPermErr */    
  338.     "Drive volume already on-line at MountVol.",    /* kVolOnLinErr */    
  339.     "No such drive (tried to mount a bad drive num).",    /* kNsDrvErr */    
  340.     "Not a mac diskette (sig bytes are wrong).",    /* kNoMacDskErr */    
  341.     "Nolume in question belongs to an external fs.",    /* kExtFSErr */    
  342.     "File system internal error:during rename the old entry was deleted but could not be restored.",    /* kFsRnErr */    
  343.     "Bad master directory block.",    /* kBadMDBErr */    
  344.     "Write permissions error.",    /* kWrPermErr */    
  345.     "Directory not found.",    /* kDirNFErr */    
  346.     "No free WDCB available.",    /* kTmwdoErr */    
  347.     "Move into offspring error.",    /* kBadMovErr */    
  348.     "Wrong volume type error [operation not supported for MFS].",    /* kWrgVolTypErr */    
  349.     "Server volume has been disconnected.",    /* kVolGoneErr */    
  350.     "Insufficient memory to complete operation."    /* kMemFullError */
  351.  
  352. }};
  353.  
  354. resource 'STR#' (kHMNUStringResStrs, purgeable){{
  355.     "\n\tHMStringResItem {", 
  356.     "^2", ", ", "^3", ", ", 
  357.     "^2", ", ", "^3", ", ",  
  358.     "^2", ", ", "^3", ", ", 
  359.     "^2", ", ", "^3", " }"
  360. }};
  361.  
  362. /* kHMNUHeaderStrs - one time file header
  363.     the ^1 matches the filename here.
  364.  */
  365. resource 'STR#' (kHeaderStrs, purgeable) {{
  366.     "/* ", "^1", " - automatically generated stub file for balloon help.\n",
  367.     "\tfrom Balloony, by David Phillip Oster, oster@netcom.com\n", 
  368.     "Connect hdlg's to dialogs by adding a line like this at the end of your DITLs:\n",
  369.     "    {0, 0, 0, 0},            helpItem { disabled, HMScanhdlg { <hdlgID> } }\n",
  370.     " */\n\n",
  371.     "#include \"BalloonTypes.r\"\n",
  372.     "#define hMenuBase    2000\n",
  373.     "#define hDlogBase    3000\n"
  374. }};
  375.  
  376. /* kHMNUNormal1Strs - before each normal menu
  377.     Note: in this string, ^3 is the resID.
  378.  */
  379. resource 'STR#' (kHMNUNormal1Strs, purgeable) {{
  380.     "\n#define ", "^1", "\t", "^3", "\n",
  381.     "#define ", "^2", " hMenuBase+", "^1", "\n",
  382.     "resource 'STR#' (", "^2", ", purgeable) {{\n"
  383. }};
  384.  
  385. resource 'STR#' (kRepeatStrs, purgeable){{
  386.     "    /* ", "^3", " */    \"",
  387. }};
  388.  
  389. resource 'STR#' (kHMNUMedialStrs, purgeable) {{
  390.     "\n}};\n\n/* The 'hmnu' resource connects menu items to STR# items.\n */\n",
  391.     "resource 'hmnu' (", "^1", ", purgeable) {\n",
  392.     "    HelpMgrVersion,\n",
  393.     "    hmDefaultOptions,\n",
  394.     "    0,    /* balloon def id */\n",
  395.     "    0,    /* var code, hang right */\n",
  396.     "    HMSkipItem {},    /* default item */\n",
  397.     "    {"
  398. }};
  399.  
  400. resource 'STR#' (kHMNUCloseStrs, purgeable) {{
  401.     "\n}};\n"
  402. }};
  403.  
  404. resource 'STR#' (kHDLGStringResStrs, purgeable){{
  405.     "\n\tHMStringResItem {{0,0}, {0,0,0,0}, ", 
  406.     "^2", ", ", "^3", ", ", 
  407.     "^2", ", ", "^3", ", ",  
  408.     "^2", ", ", "^3", ", ", 
  409.     "^2", ", ", "^3", " }"
  410. }};
  411.  
  412.  
  413. /* kHDLGNormal1Strs - before each normal dialog
  414.  */
  415. resource 'STR#' (kHDLGNormal1Strs, purgeable) {{
  416.     "\n#define ", "^1", "\t", "^3", "\n",
  417.     "#define ", "^2", " hDlogBase+", "^1", "\n",
  418.     "resource 'STR#' (", "^2", ", purgeable) {{\n"
  419. }};
  420.  
  421. resource 'STR#' (kHDLGMedialStrs, purgeable) {{
  422.     "\n}};\n\n/* The 'dlg' resource connects ditl items to STR# items.\n */\n",
  423.     "resource 'hdlg' (", "^1", ", purgeable) {\n",
  424.     "    HelpMgrVersion,\n",
  425.     "    0,    /* start with first item */\n"
  426.     "    hmDefaultOptions,\n",
  427.     "    0,    /* balloon def id */\n",
  428.     "    0,    /* var code, hang right */\n",
  429.     "    HMSkipItem {},    /* default item */\n",
  430.     "    {"
  431. }};
  432.  
  433.  
  434. resource 'STR#' (kHDLGCloseStrs, purgeable) {{
  435.     "\n}};\n"
  436. }};
  437.  
  438. resource 'BNDL' (128, purgeable) {
  439.     'by®D', 0, {
  440.     'FREF',    {
  441.             0, 128,
  442.             1, 129,
  443.             2, 130,
  444.             3, 131,
  445.             4, 132,
  446.             5, 133
  447.     },
  448.     'ICN#', {
  449.             0, 128,
  450.             1, 129
  451.             2, 0,
  452.             3, 0,
  453.             4, 0,
  454.             5, 0
  455.         }
  456.     }
  457. };
  458.  
  459. type 'by®D' as 'STR ';
  460.  
  461.  
  462. resource 'by®D' (0, purgeable) {
  463.     "Copyright © 1994 David Phillip Oster"
  464. };
  465.  
  466. resource 'FREF' (128, purgeable) {
  467.     'APPL',
  468.     0,
  469.     ""
  470. };
  471.  
  472. resource 'FREF' (129, purgeable) {
  473.     'by®D',
  474.     1,
  475.     ""
  476. };
  477.  
  478. resource 'FREF' (130, purgeable) {
  479.     '????',
  480.     2,
  481.     ""
  482. };
  483.  
  484. /* open resEdit resource files.
  485.  */
  486. resource 'FREF' (131, purgeable) {
  487.     'rsrc',
  488.     3,
  489.     ""
  490. };
  491.  
  492. /* open Resorcerer resource files.
  493.  */
  494. resource 'FREF' (132, purgeable) {
  495.     'RSRC',
  496.     4,
  497.     ""
  498. };
  499.  
  500. /* open desk accessory suitcase files.
  501.  */
  502. resource 'FREF' (133, purgeable) {
  503.     'dfil',
  504.     5,
  505.     ""
  506. };
  507.  
  508.  
  509. type 'TEXT' { string; }; 
  510.  
  511. resource 'TEXT' (128) {
  512. "Balloony: Version 1.00. A program to create stub balloon help .r files from an application. Just drop your application onto it. "
  513. "Copyright © by David Phillip Oster, 1994, All Rights Reserved. Write to me at oster@netcom.com for more information."
  514. };
  515.  
  516. resource 'hfdr' (-5696) {
  517.     HelpMgrVersion, hmDefaultOptions, 0, 0,
  518.     {
  519.         HMTEResItem{ 128 }
  520. }};
  521.  
  522. resource 'vers' (1, purgeable) {
  523.     0x1,
  524.     0x0,
  525.     final,
  526.     0x0,
  527.     verUS,
  528.     "Copyright © 1994 David Phillip Oster",
  529.     "Copyright © 1994 David Phillip Oster, oster@netcom.com"
  530. };
  531.  
  532.  
  533.